package cn.ms.neural.moduler.extension.blackwhite;

import java.util.Map;

import cn.ms.neural.moduler.IModuler;
import cn.ms.neural.moduler.extension.blackwhite.conf.BlackWhiteConf;
import cn.ms.neural.moduler.extension.blackwhite.entity.BlackWhiteEntity;
import cn.ms.neural.moduler.extension.blackwhite.support.IBlackWhiteProcessor;

public interface IBlackWhite<REQ, RES> extends IModuler<REQ, RES> {

	/**
	 * 注入黑白名单配置与规则
	 * 
	 * @param blackWhiteConf
	 * @param blackWhiteListMap {{key,[blackRule]},{key,[whiteRule]},{key,[blackRule,whiteRule]}...}
	 */
	 void inject(BlackWhiteConf blackWhiteConf, Map<String, BlackWhiteEntity[]> blackWhiteListMap);
	 
	 /**
	  * 黑白名单控制
	  * 
	  * @param blackWhiteREQ
	  * @param blackWhiteIdKeyVals
	  * @param blackWhiteProcessor
	  * @param args
	  * @return
	  * @throws Throwable
	  */
	 RES blackwhite(REQ blackWhiteREQ, Map<String, Object> blackWhiteIdKeyVals, IBlackWhiteProcessor<REQ, RES> blackWhiteProcessor, Object... args) throws Throwable;
	
}
